//
//  FirstBarViewController.m
//  JiJinFinance
//
//  Created by 李东晓 on 15/12/1.
//  Copyright © 2015年 LiDongXiao. All rights reserved.
//

#import "FirstBarViewController.h"
#import "SDCycleScrollView.h"
#import "SecToViewController.h"
#import "LoginViewController.h"
@interface FirstBarViewController ()<SDCycleScrollViewDelegate>

//信息Label
@property (strong, nonatomic) IBOutlet UILabel *LabelChe;
@property (strong, nonatomic) IBOutlet UILabel *LabelSY;
@property (strong, nonatomic) IBOutlet UILabel *LabelHK;
@property (strong, nonatomic) IBOutlet UILabel *LabelRZ;
@property (strong, nonatomic) IBOutlet UILabel *LabelQX;
//立即投资按钮
@property (strong, nonatomic) IBOutlet UIButton *InvestButton;

@end

@implementation FirstBarViewController
-(void)viewWillAppear:(BOOL)animated
{
    [self.tabBarController.tabBar setHidden:NO];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.navigationItem.title = @"集金金融";
    //自定义集金金融的大小
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:19],
                                                                      
                                                                      NSForegroundColorAttributeName:[UIColor whiteColor]}];
    
    [_InvestButton.layer setMasksToBounds:YES];
    _InvestButton.layer.cornerRadius = 5;
    
    [self SDCycleView];
    
    [self Frame];
}
-(void)Frame
{
    //爱车贷
    [_LabelChe setFrame:CGRectMake(143*D_width, 264*D_height, 88*D_width, 28*D_height)];
    [_LabelChe setFont:[UIFont systemFontOfSize:28*D_height]];
    
    //预期收益
    [_LabelSY setFrame:CGRectMake(84*D_width, 307*D_height, 208*D_width, 22*D_height)];
    [_LabelSY setFont:[UIFont systemFontOfSize:22*D_height]];
    
    //期限
    [_LabelQX setFrame:CGRectMake(154*D_width, 361*D_height, 68*D_width, 14*D_height)];
    [_LabelQX setFont:[UIFont systemFontOfSize:14*D_height]];
    
    //融资
    [_LabelRZ setFrame:CGRectMake(129*D_width, 390*D_height, 117*D_width, 17*D_height)];
    [_LabelRZ setFont:[UIFont systemFontOfSize:17*D_height]];
    
    //立即投资
    [_InvestButton setFrame:CGRectMake(68*D_width, 447*D_height, 239*D_width, 46*D_height)];
    //还款
    [_LabelHK setFrame:CGRectMake(71*D_width, 510*D_height, 233*D_width, 10*D_height)];
    [_LabelHK setFont:[UIFont systemFontOfSize:10*D_height]];
}
//首页轮播图
-(void)SDCycleView
{
    NSArray * image = @[[UIImage imageNamed:@"lunbo"],
                        [UIImage imageNamed:@"lunbo"],
                        [UIImage imageNamed:@"lunbo"]];
    
    SDCycleScrollView * cycleView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, kNavigationBarHeight, kUIScreenWidth, 160*D_height) imagesGroup:image];
    
    [cycleView setInfiniteLoop:YES];
    [cycleView setDelegate:self];
    [cycleView setPageControlStyle:SDCycleScrollViewPageContolStyleAnimated];
    //        --- 轮播时间间隔，默认1.0秒，可自定义
    cycleView.autoScrollTimeInterval = 2.0;
    [self.view addSubview:cycleView];
    //    //网络加载 --- 创建带标题的图片轮播器
    //    SDCycleScrollView *cycleScrollView2 = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 320, w, 180) imageURLStringsGroup:nil]; // 模拟网络延时情景
    //    cycleScrollView2.pageControlAliment = SDCycleScrollViewPageContolAlimentRight;
    //    cycleScrollView2.delegate = self;
    //    cycleScrollView2.titlesGroup = titles;
    //    cycleScrollView2.dotColor = [UIColor yellowColor]; // 自定义分页控件小圆标颜色
    //    //    cycleScrollView2.placeholderImage = [UIImage imageNamed:@"placeholder"];
    //    [self.view addSubview:cycleScrollView2];
    //
    //    //             --- 模拟加载延迟
    //    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
    //        cycleScrollView2.imageURLStringsGroup = imagesURLStrings;
    //    });
    //
    //
    //    // 清除缓存
    //    [cycleScrollView2 clearCache];
}
- (IBAction)LJTZClcik {
    
    SecToViewController * secTo = [[SecToViewController alloc]init];
    
    [self.navigationController pushViewController:secTo animated:YES];
    
}



-(void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index
{
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
